import { request } from '@inbiz/utils';

export const getMemberInfo = (
  data: {
    memberType: string;
    memberIds: string[];
  }[],
  props: any,
) => {
  let url = `/inbiz/api/services/modelengine/v${InbizConfig.API_VERSION}/control/getMemberInfo`;
  if (props.childModelConfig) {
    url = `/inbiz/api/services/modelengine/v${InbizConfig.API_VERSION}/business/selectDatas`;
  }
  if (data && !props.childModelConfig) {
    return request(url, {
      method: 'POST',
      data,
    });
  } else if (props.childModelConfig) {
    return request.post(url, {
      data: {
        name: props?.storageConfig?.name,
        data: {
          ref_id: props?.inbiz?.queryData?.id,
          controlid: props?.controlId,
        },
      },
    });
  } else {
    return new Promise((resolve, reject) => {
      resolve({
        data: {
          FolderInfoList: [],
          FileInfoList: [],
        },
        dataDescription: '',
        message: '',
        result: 0,
      });
    });
  }
};
